package com.sat.user.controller;

import com.sat.common.entity.Result;
import com.sat.user.model.Address;
import com.sat.user.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("address")
public class AddressController {

    @Autowired
    private AddressService addressService;
    /**
     * 根据用户查询地址信息
     * @return
     */
    @GetMapping
    public Result getByUserName(){
        String username="admin";//一般这个username不用我们传进来，登录了就可以获取使用jwt
        List<Address> list=addressService.getByUserName(username);
        return Result.OK(list);
    }
}
